<?php
class CommonController extends Base
{
	protected $lang;
	protected $cfg;
	protected $lang_list;
	public function __construct(){
		parent::__construct();
		$this->lang              = $this->_getLang();
		$this->cfg               = $this->_getSystem();
		require_once ROOT_PATH.'Lang/'.$this->lang['lang_key'].'.php';
		$lang_name               = $this->lang['name'];
		$this->lang              = $lang;
		$this->lang['lang_name'] = $lang_name;
	}
	// 取得域名
	private function _domain(){
		$domain 	= getDomain();
		return $domain;
	}
	// 看当前语言
	private function _getLang(){
		$vo 	= $this->db->table("@_lang")->where("domain='".$this->_domain()."'")->find();
		if (empty($vo)) {
			$lng 	= getGpc('lng', 'string', 'G');
			if (empty($lng)) {
				$vo 	= $this->db->table("@_lang")->order("id ASC")->find();
			} else {
				$vo 	= $this->db->table("@_lang")->where("lang_key='$lng'")->find();
			}
		}
		return $vo;
	}
	//取得当前的网站配置信息
	private function _getSystem(){
		$vo = $this->db->table("@_system_info")->where("lang_id=".$this->lang['id'])->find();
		return $vo;
	}
}
?>